<template>
  <div>
    <el-tree
      :data="treeData"
      :props="defaultProps"
      :default-expand-all="expand"
      @node-click="handleNodeClick"
    >
    </el-tree>
  </div>
</template>

<script>
export default {
  props: ["treeData","label","children"],
  data() {
    return {
      data: [],
      expand: true,
      defaultProps: {
        children: "",
        label: "",
      },
    };
  },
  created() {
    this.defaultProps.label = this.label
    this.defaultProps.children = this.children
  },
  methods: {
      //获取节点数据
      handleNodeClick(data) {
          var nodeData = new Array(data);
          this.$emit("getNodeData", nodeData);
      }
  },
};
</script>